<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/jquery.min.js?ver=<?= $config['version'] ?>"></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.core.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.line.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.dynamic.js" ></script>	


	
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
    <?php
    	//print_r($reportGraph); 
    	//print_r($eventGraphList);
    	//print_r($channelList);
    	//print_r($platformList);
    	//print_r($osverList);
    	//print_r($networkList);
    	//print_r($deviceList);
    	//print_r($gameverList);
    ?>
 
   <p>&nbsp;</p>  <p>&nbsp;</p> <p>&nbsp;</p> 
   <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
     <tr>
       </center><td>&nbsp;
       <center>
       <?= translate('MESSAGE_CRASHREPORT_CHANNEL') ?>:<?=$channel ?>&nbsp;&nbsp;
       <?= translate('MESSAGE_FENXIREPORTGRAPH_PLATFORM') ?>:<?=$platform ?>&nbsp;&nbsp;
       <?= translate('MESSAGE_FENXIREPORTGRAPH_OSVER') ?>:<?=$osver ?>&nbsp;&nbsp;
       <?= translate('MESSAGE_FENXIREPORTGRAPH_NETWORK') ?>:<?=$network ?>&nbsp;&nbsp;
       <?= translate('MESSAGE_FENXIREPORTGRAPH_DEVICE') ?>:<?=$device ?>&nbsp;&nbsp;
       <?= translate('MESSAGE_FENXIREPORTGRAPH_GAMEVER') ?>:<?=$gamever ?>&nbsp;&nbsp;
       &nbsp;&nbsp;
       <?= translate('STARTTIME') ?>:<?= $startTime ?> &nbsp;&nbsp;
       <?= translate('ENDTIME') ?>:<?= $endTime ?></center></td>
     </tr>
     
     <?php
     	$data = "";
    	$labels = "";
      ?>
     
     <tr>
       <td>
        <table border='1' >
         <tr>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_INSERTTIME') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_LOGINSTART') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_CHECKUPDATE') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_CHECKXML') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_GETXML') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_GETXMLRETURN') ?></td>           	
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_SDKSTART') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_CONLOGINSERVER') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_CONLOGINSERVERBACK') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_THREELOGIN') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_LOGINSUCCESS') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_VERIFYTOKEN') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_VERIFYTOKENOVER') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_VERIFYACCOUNT') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_VERIFYACCOUNTOVER') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_SELECTAREA') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_SELECTAREABACK') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_CONGATESERVER') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_CONGATESERVERBACK') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_SELECTROLE') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORT_STARTGAME') ?></td>
           	<td>&nbsp;<?= translate('MESSAGE_FENXIREPORTGRAPH_SUCCESS') ?></td>
         </tr>
         <?php 
         	$labels .= "'".translate('MESSAGE_FENXIREPORT_LOGINSTART')."'";	
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_CHECKUPDATE')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_CHECKXML')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_GETXML')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_GETXMLRETURN')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_SDKSTART')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_CONLOGINSERVER')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_CONLOGINSERVERBACK')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_THREELOGIN')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_LOGINSUCCESS')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_VERIFYTOKEN')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_VERIFYTOKENOVER')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_VERIFYACCOUNT')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_VERIFYACCOUNTOVER')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_SELECTAREA')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_SELECTAREABACK')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_CONGATESERVER')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_CONGATESERVERBACK')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_SELECTROLE')."'";
         	$labels .= ",'".translate('MESSAGE_FENXIREPORT_STARTGAME')."'";
         
         	$total = array();
         	//print_r($reportGraph);
         ?>
         
           <?php foreach ($reportGraph as $key=>$value) { ?>
           <tr>
           		<td>&nbsp;<?=$key ?></td>
           		<td>&nbsp;<?=$value['loginstart'] ?></td>
           		<td>&nbsp;<?=$value['checkupdate'] ?></td>
           		<td>&nbsp;<?=$value['checkxml'] ?></td>
           		<td>&nbsp;<?=$value['getxml'] ?></td>
           		<td>&nbsp;<?=$value['getxmlreturn'] ?></td>
           		<td>&nbsp;<?=$value['sdkstart'] ?></td>
           		<td>&nbsp;<?=$value['conloginserver'] ?></td>
           		<td>&nbsp;<?=$value['conloginserverback'] ?></td>
           		<td>&nbsp;<?=$value['threelogin'] ?></td>
           		<td>&nbsp;<?=$value['loginsuccess'] ?></td>
           		<td>&nbsp;<?=$value['verifytoken'] ?></td>
           		<td>&nbsp;<?=$value['verifytokenover'] ?></td>
           		<td>&nbsp;<?=$value['verifyaccount'] ?></td>
           		<td>&nbsp;<?=$value['verifyaccountover'] ?></td>
           		<td>&nbsp;<?=$value['selectarea'] ?></td>
           		<td>&nbsp;<?=$value['selectareaback'] ?></td>
           		<td>&nbsp;<?=$value['congateserver'] ?></td>
           		<td>&nbsp;<?=$value['congateserverback'] ?></td>
           		<td>&nbsp;<?=$value['selectrole'] ?></td>
           		<td>&nbsp;<?=$value['startgame'] ?></td>
           		<td>&nbsp;
           		<?php 
           		if(0 == $value['loginstart'] || 0 == $value['startgame'] ) {echo "0%";} 
           		else { echo (sprintf("%.2f", ($value['startgame']/$value['loginstart'])*100))."%";} 
           		?>
           		</td>
           		<?php
           			$total['loginstart'] += $value['loginstart']; 
           			$total['checkupdate'] += $value['checkupdate'];
           			$total['checkxml'] += $value['checkxml'];
           			$total['getxml'] += $value['getxml'];
           			$total['getxmlreturn'] += $value['getxmlreturn'];
           			$total['sdkstart'] += $value['sdkstart'];
           			$total['conloginserver'] += $value['conloginserver'];
           			$total['conloginserverback'] += $value['conloginserverback'];
           			$total['threelogin'] += $value['threelogin'];
           			$total['loginsuccess'] += $value['loginsuccess'];
           			$total['verifytoken'] += $value['verifytoken'];
           			$total['verifytokenover'] += $value['verifytokenover'];
           			$total['verifyaccount'] += $value['verifyaccount'];
           			$total['verifyaccountover'] += $value['verifyaccountover'];
           			$total['selectarea'] += $value['selectarea'];
           			$total['selectareaback'] += $value['selectareaback'];
           			$total['congateserver'] += $value['congateserver'];
           			$total['congateserverback'] += $value['congateserverback'];
           			$total['selectrole'] += $value['selectrole'];
           			$total['startgame'] += $value['startgame'];
           		?>
           	</tr>	
           <?php } ?>
         
         
         <tr>
           		<td>&nbsp;<?= translate('MESSAGE_FENXIREPORTGRAPH_TOTAL') ?></td>
           		<td>&nbsp;<?=$total['loginstart'] ?></td>
           		<td>&nbsp;<?=$total['checkupdate'] ?></td>
           		<td>&nbsp;<?=$total['checkxml'] ?></td>
           		<td>&nbsp;<?=$total['getxml'] ?></td>
           		<td>&nbsp;<?=$total['getxmlreturn'] ?></td>
           		<td>&nbsp;<?=$total['sdkstart'] ?></td>
           		<td>&nbsp;<?=$total['conloginserver'] ?></td>
           		<td>&nbsp;<?=$total['conloginserverback'] ?></td>
           		<td>&nbsp;<?=$total['threelogin'] ?></td>
           		<td>&nbsp;<?=$total['loginsuccess'] ?></td>
           		<td>&nbsp;<?=$total['verifytoken'] ?></td>
           		<td>&nbsp;<?=$total['verifytokenover'] ?></td>
           		<td>&nbsp;<?=$total['verifyaccount'] ?></td>
           		<td>&nbsp;<?=$total['verifyaccountover'] ?></td>
           		<td>&nbsp;<?=$total['selectarea'] ?></td>
           		<td>&nbsp;<?=$total['selectareaback'] ?></td>
           		<td>&nbsp;<?=$total['congateserver'] ?></td>
           		<td>&nbsp;<?=$total['congateserverback'] ?></td>
           		<td>&nbsp;<?=$total['selectrole'] ?></td>
           		<td>&nbsp;<?=$total['startgame'] ?></td>
				<td>&nbsp;
           		<?php 
           		if(0 == $total['loginstart'] || 0 == $total['startgame'] ) {echo "0%";} 
           		else { echo (sprintf("%.2f", ($total['startgame']/$total['loginstart'])*100))."%";} 
           		?>
           		</td>
         </tr>
         
       </table>
       </td>
     </tr>
   </table>
   
    
   <?php
   //print_r($total);
   //print_r($labels); 
   ?>
   <canvas id="cvs" width="2500" height="500" style="border: 1px solid #ddd">[No canvas support]</canvas>
   <!--  <div id="chart1" style="height:300px; width:600px;"></div> -->
   <br>
   <form action="" method="POST" id="rowForm">
            <table width="100%" border="1" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
            
            	<tr><td><?= translate('MESSAGE_CRASHREPORT_CHANNEL') ?>:</td>
            		<td><select name="row[channel]" id="channel">
                      	<option value="all">all</option>
                      	<?php foreach ($channelList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $channel) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_PLATFORM') ?>:</td>
            		<td><select name="row[platform]" id="platform">
                      	<option value="all">all</option>
                      	<?php foreach ($platformList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $platform) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_OSVER') ?>:</td>
            		<td><select name="row[osver]" id="osver">
                      	<option value="all">all</option>
                      	<?php foreach ($osverList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $osver) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_NETWORK') ?>:</td>
            		<td><select name="row[network]" id="network">
                      	<option value="all">all</option>
                      	<?php foreach ($networkList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $network) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_DEVICE') ?>:</td>
            		<td><select name="row[device]" id="device">
                      	<option value="all">all</option>
                      	<?php foreach ($deviceList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $device) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>
   		        
   		        <tr><td><?= translate('MESSAGE_FENXIREPORTGRAPH_GAMEVER') ?>:</td>
            		<td><select name="row[gamever]" id="gamever">
                      	<option value="all">all</option>
                      	<?php foreach ($gameverList as $key => $value) {?>
            		    <option value="<?=$key ?>" <?php if($value == $gamever) echo "selected";?> ><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>   		          
   		          
                <tr><td><?= translate('STARTTIME') ?>:</td><td><input type='text' name='row[starttime]' id='starttime' class='datepicker' value="<?= $startTime ?>"/></td></tr>
                <tr><td><?= translate('ENDTIME') ?>:</td><td><input type="text" name="row[endtime]" id="endtime" class='datepicker'  value="<?= $endTime ?>"/></td></tr>
                <tr></tr>
                <tr><td></td><td>
	                <input type="submit" value="<?= translate('SHENGCHENG') ?>" id="submit"/> 
                </td></tr>
            </table>
   </form>
	
	<?php 
    
    	foreach ($total as $key=>$value) {
    			$data .=$value.",";	
    	}
    	//echo json_encode($total);
    	 $data = substr($data,0, -1);
    	 //$labels = substr($labels,0, -1);
    	 //print_r($total);
    	 //echo " data=$data ";
    	 //echo " labels=$labels ";
     ?> 
	
    <script>
    
     $(document).ready(function ()
    	        {
    	            var line = new RGraph.Line({
    	                id: 'cvs',
    	                data: [<?=$data ?>],
    	                options: {
    	                    labels: [<?=$labels ?>]
    	                }
    	            }).draw()
    	        })
    </script>
    <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                $("#starttime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#endtime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#platform").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#game").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});  
                //$("#server").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});                  
                //$("#type").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
            });
        </script>
    </body>
 </html>